{% extends 'base.html.twig' %}

{% block body %}
    <script>
        var route = "{{ path('blog_show', {'slug': 'my-blog-post'})|escape('js') }}";
        document.write(route);


        //js 代码中生成 .js
        // var url = Routing.generate('blog_show', {
        //     'slug': 'my-blog-post'
        // });
    </script>
{% endblock %}